<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<head>
<meta charset="UTF-8" />
</head>
<div class="modal fade " id="payIndentModal" tabindex="-1" role="dialog"
	aria-labelledby="payIndentModalLabel" style="top: 50px"
	aria-hidden="true">
	<div class="modal-dialog ">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">
					<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
				</button>
				<h4 class="modal-title" id="payIndentModalLabel">费用详情</h4>
			</div>
			<div class="modal-body" id="payIndentModal"	style="width: 570px; height: 260px;">
				<form class="form-horizontal" id="payMeasureIndentForm" action=""
					method="post" target="_blank" role="form">
					<!-- <input type="" name="indentID" id="txt_measureIndentID"> -->
					<input type="hidden" name="crampetNumber" id="txt_crampetPrice" value="0"> 
					<input type="hidden" name="fourClawNumber" id="txt_fourClawPrice" value="0"> 
					<input type="hidden" name="motorNumber" id="txt_motorPrice" value="0"> 
					<input type="hidden" name="relievedBao" id="" value="0">
					<div class="form-group">
						<label for="" class="col-sm-3 control-label">订单号：</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="txt_measureIndentID"
								readonly="readonly" name="indentID">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">订单价格：</label>
						<div class="col-sm-9">
							<input id="txt_merchantPrice" type="text" class="form-control"
								readonly="readonly">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label">悬赏费用：</label>
						<div class="col-sm-9">
							<input id="txt_addPrice" type="text" class="form-control" name="addPrice">
						</div>
					</div>
				</form>
				<div class="form-group">
					<div class="col-lg-offset-2 col-lg-10"
						style="position: relative; margin-left: 225px; margin-top: 40px;">
						<button type="button" class="btn btn-primary"
							onclick="payInstallIndent('${ctxPath }/payment/rewardIndent')">支付宝支付</button>
						<button type="button" class="btn btn-primary" onclick="inputPwd()">余额支付</button>
						<button type="button" class="btn grey-salsa btn-outline"
							onclick="javascript:$('#payIndentForm')[0].reset()"
							data-dismiss="modal">关闭</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
function inputPwd() {
	$('#viewCustomerPasswordDetialModal').modal('show');
}

//发送悬赏数据请求数据
function rechargeSendDatas(){
	var addPrice = $("#payIndentModal  #txt_addPrice").val()
	var indentId=$("#payIndentModal  #txt_measureIndentID").val();
	var totalMoney=addPrice;
	var relievedBao=0;
	var url='${ctxPath }/payment/balancePay';
	var password=$("#viewCustomerPasswordDetialModal  #txt_customerPasswordNumber").val();
	var encrypedPwd =encryPwd(password);
	var type=3;
	sendRechargeReqest(indentId,encrypedPwd,addPrice,relievedBao,totalMoney,url,type);
}

function sendRechargeReqest(indentId,encrypedPwd,addPrice,
		relievedBao,totalMoney,url,type){
	if(! encrypedPwd){
		toastr.error("密码不能为空！");
		return;
	}
	if(! indentId){
		return;
	}
	if(addPrice=='0'){
		toastr.error("悬赏费用不能为 0");
		return;
	}
	$.ajax({
		url : url,
		type : 'post',
		dataType : 'JSON',
		data : {
			indentId : indentId,
			totalMoney : totalMoney,
			password : encrypedPwd,
			addPrice : addPrice,
			relievedBao : relievedBao,
			type:type
		},
		success : function(data) {
			if (data.status == 0) {
				toastr.success("支付成功！");
				$("#wallet").find("span").first().html(data.data);
				$("button[name='refresh']").trigger("click");
			} else {
				toastr.error("支付失败！");
			}
		}
	});
	$("#payIndentModal").modal('hide');
}
</script>

